package com.thrift.demo;

import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TTransportException;

/**
 * Created by lizhenxing on 2017/3/31.
 */
public class HelloServiceServer {

    public static void main(String[] args) throws TTransportException {
        TServerSocket serverSocket = new TServerSocket(7099);
        TBinaryProtocol.Factory factory = new TBinaryProtocol.Factory();
        Hello.Processor<HelloServiceImpl> processor = new Hello.Processor<>(new HelloServiceImpl());
        TThreadPoolServer.Args args1 = new TThreadPoolServer.Args(serverSocket);
        args1.processor(processor).inputProtocolFactory(factory);
        TServer server = new TThreadPoolServer(args1);

        System.out.println("start server ...");
        server.serve();
    }
}
